<template>
	<view class="sheet-item" @click="toDetail">
		<view class="item-title">
			<icon-text icon-path="" :icon-position="0" :icon-text="sheetNum"></icon-text>
		</view>
		<view class="item-column">
			<view class="column-name">设备名称:</view>
			<view class="column-value">{{ workSheet.devName }}</view>
		</view>
		<view class="item-column">
			<view class="">设备mac:</view>
			<view class="column-value">{{ workSheet.macAddres }}</view>
		</view>
		<view class="item-column">
			<view class="">故障原因:</view>
			<view class="column-value">{{ workSheet.faultReason }}</view>
		</view>
			<view class="item-column">
				<view class="">报修人:</view>
				<view class="column-value">{{ workSheet.reportMan }}</view>
			</view>

		<view class="item-column-sub" v-if="workSheet.repairMan">
			<view class="item-con">
				<view>维修人:</view>
				<view class="column-value">{{ workSheet.repairMan }}</view>
			</view>
			<view>{{ workSheet.repairTime }}</view>
			<u-button type="primary" size="mini">{{ stateText }}</u-button>
			</view>
		<u-line v-if="!isLast" border-style="dashed" color="#e9e9e9"></u-line>
	</view>
	
</template>

<script>
	import iconText from '@/components/icon-text.vue'
	export default{
		components:{
			iconText
		},
		data(){
			return{
				
			}
		},
		computed:{
			sheetNum(){
				return '单号:'+this.workSheet.orderNum
			},
			stateText(){
				if(this.workSheet.state === 0){
					return '待处理'
				}else if(this.workSheet.state === 1){
					return '待维修'
				}else if(this.workSheet.state === 2){
					return '已修好'
				}else if(this.workSheet.state === 3){
					return '待审核'
				}else if(this.workSheet.state === 4){
					return '已完成'
				}else{
					return '未知状态'
				}
			},
			
		},
		methods:{
			toDetail(){
				this.$emit('toDetail',this.workSheet)
			}
		},
		props:{
			workSheet:{
				type:Object,
				default:()=>{}
			},
			isLast:{
				type:Boolean,
				default:false
			}
		}
	}
</script>
<style scoped lang="scss">
	.sheet-item{
		display: flex;
		flex-direction: column;
		border: 2rpx solid #e9e9e9;
		margin-bottom: 30rpx;
		background: #ffffff;
		border-radius: 10rpx;
		
		.item-title{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			padding: 20rpx 15rpx;
			font-weight: bold;
			font-size: 28rpx;
			border-bottom: 2rpx solid #e9e9e9;
		}
		.item-column{
			display: flex;
			flex-direction: row;
			padding:30rpx 30rpx 0 30rpx;
			
		}
		.item-state{
			display: flex;
			flex-direction: row;
			justify-content: flex-end;
			align-items: center;
		}
		.item-column-sub{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			padding:30rpx;
			border-top:2rpx solid #e9e9e9;
			
		}
	}
</style>

